Equal-cost multi-path (ECMP) means that there are multiple different routing paths having equal cost for arriving at a same destination Internet. Protocol (IP) address or a destination network segment. In an ECMP network environment, operation and maintenance personnel may perform path trace and fault locating and diagnosis for a service packet by using an operation administration and maintenance (OAM) detection technology.
In the prior art, a sampling point may be deployed in a network to collect a target service packet. The sampling point uses a protocol such as NetFlow or SFlow to process a sampling packet, and then sends a processed sampling packet to a centralized sampling data analysis center. The sampling data analysis center analyzes a link through which the sampling packet passes in the network within a same time period, so as to obtain, according to the sampling packet, a forwarding path through which the target service packet passes in the network. However, excessive network resources need to be consumed to obtain the sampling packet, and perform analysis and processing by the sampling data analysis center, and detection efficiency and accuracy are relatively low.
Optionally, path trace and fault locating and diagnosis for the service packet may be performed by using a RouteTrace mechanism based on an Internet Control Message Protocol (ICMP), or Ether CAM LinkTrace mechanism based on connectivity fault management (CFM), or a Label Switching Path (LSP) TraceRT mechanism based on Multiprotocol Label Switching (MPLS) CAM, or the like. A specific step for performing path trace and fault locating and diagnosis for the service packet according to the foregoing CAM protocol mechanism includes: A path detection initiation device includes a time to live (Time To Live, TTL) field in a path detection packet, where an initial TTL is 1, and after the path detection initiation device receives a response from another forwarding device, TTL is gradually increased by 1. Because the service packet includes not only a destination IP address or a Media Access Control (MAC) address, in the ECMP network environment, a hash value of a quintet of a path detection packet obtained according to a hash algorithm may be used as a routing key value. The routing key value is used to determine a forwarding path of the path detection packet. Different bash algorithms may be configured in various forwarding devices, the forwarding path of the path detection packet and a forwarding path of the service packet may be different, and therefore, a forwarding path of the target service packet may not be accurately detected.
Therefore, how to accurately obtain a forwarding path of a service packet becomes an urgent problem to be resolved.